﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="Site.master"  CodeBehind="CargoForm.aspx.cs" EnableEventValidation="false" Inherits="DigDes.DSchool.SUPS.Web.UI.CargoForm" %>

<asp:Content ID="Cargo" ContentPlaceHolderID="Main" runat="Server">
    <asp:GridView 
        ID="GridView1"
        runat="server"
        DataKeyNames="Cargo_ID"
        AutoGenerateColumns="False"
        OnRowDataBound="OnRowDataBound"
        OnSelectedIndexChanged ="OnSelectedIndexChanged"
        DataSourceID="GridViewODS" 
        CellPadding="4" 
        GridLines="Horizontal" 
        BackColor="White" 
        BorderColor="#336666" 
        BorderStyle="Double" 
        BorderWidth="3px" 
        AllowPaging="True">
        <Columns>
            <asp:BoundField DataField="Cargo_ID" HeaderText="Cargo_ID" SortExpression="Cargo_ID" />
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <asp:BoundField DataField="NameEng" HeaderText="NameEng" SortExpression="NameEng" />
            <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
            <asp:BoundField DataField="DescriptionEng" HeaderText="DescriptionEng" SortExpression="DescriptionEng" />
            <asp:BoundField DataField="ShortCode" HeaderText="ShortCode" SortExpression="ShortCode" />
            <asp:BoundField DataField="Code" HeaderText="Code" SortExpression="Code" />
            <asp:BoundField DataField="CodeGNG" HeaderText="CodeGNG" SortExpression="CodeGNG" />
            <asp:BoundField DataField="Mnemocode" HeaderText="Mnemocode" SortExpression="Mnemocode" />
            <asp:BoundField DataField="MnemocodeEng" HeaderText="MnemocodeEng" SortExpression="MnemocodeEng" />
            <asp:CheckBoxField DataField="IsUsed" HeaderText="IsUsed" SortExpression="IsUsed" />
            <asp:CheckBoxField DataField="IsEmpty" HeaderText="IsEmpty" SortExpression="IsEmpty" />
            <asp:TemplateField HeaderText="Image">
                        <ItemTemplate>
                            <asp:Image ID="Image1" runat="server" ImageUrl='<%# "~/CargoImage.ashx?Cargo_ID=" + Eval("Cargo_ID")%>'/>
                        </ItemTemplate>
                     </asp:TemplateField>
        </Columns>
        <FooterStyle BackColor="White" ForeColor="#333333" />
        <HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="White" ForeColor="#333333" />
        <SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#F7F7F7" />
        <SortedAscendingHeaderStyle BackColor="#487575" />
        <SortedDescendingCellStyle BackColor="#E5E5E5" />
        <SortedDescendingHeaderStyle BackColor="#275353" />
    </asp:GridView>
    <asp:ObjectDataSource 
        ID="GridViewODS" 
        runat="server" 
        OldValuesParameterFormatString="original_{0}" 
        EnablePaging="True" 
        SelectMethod="GetTable" 
        SelectCountMethod="CountCargo"
        TypeName="DigDes.DSchool.SUPS.DataAccess.Database.DataRdr_Cargo">
        <SelectParameters>
            <asp:Parameter Name="startRowIndex" Type="Int32" />
            <asp:Parameter Name="maximumRows" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource 
        ID="DetailsViewODS" 
        runat="server" 
        OldValuesParameterFormatString="original_{0}" 
        InsertMethod="InsertRow"
        SelectMethod="GetSelectedRow"
        TypeName="DigDes.DSchool.SUPS.DataAccess.Database.DataRdr_Cargo" UpdateMethod="UpdateRow">
        <InsertParameters>
            <asp:Parameter Name="Cargo_ID" Type="Int32" />
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="NameEng" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="DescriptionEng" Type="String" />
            <asp:Parameter Name="ShortCode" Type="String" />
            <asp:Parameter Name="Code" Type="String" />
            <asp:Parameter Name="CodeGNG" Type="String" />
            <asp:Parameter Name="Mnemocode" Type="String" />
            <asp:Parameter Name="MnemocodeEng" Type="String" />
            <asp:Parameter Name="IsUsed" Type="Boolean" />
            <asp:Parameter Name="IsEmpty" Type="Boolean" />
        </InsertParameters>
        <SelectParameters>
            <asp:ControlParameter 
                ControlID="GridView1" 
                Name="Cargo_ID" 
                PropertyName="SelectedValue" 
                Type="String" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="Cargo_ID" Type="String" />
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="NameEng" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="DescriptionEng" Type="String" />
            <asp:Parameter Name="ShortCode" Type="String" />
            <asp:Parameter Name="Code" Type="String" />
            <asp:Parameter Name="CodeGNG" Type="String" />
            <asp:Parameter Name="Mnemocode" Type="String" />
            <asp:Parameter Name="MnemocodeEng" Type="String" />
            <asp:Parameter Name="IsUsed" Type="Boolean" />
            <asp:Parameter Name="IsEmpty" Type="Boolean" />
        </UpdateParameters>
    </asp:ObjectDataSource>
    <asp:Button ID="Add" runat="server" Text="Добавить" OnClick="Add_Click" />
    <asp:Button ID="Edit" runat="server" Text="Редактировать" OnClick="Edit_Click" />
    <asp:Button ID="Delete" runat="server" style="margin-bottom: 0px" Text="Удалить" OnClick="Delete_Click" />
    <br />
    <asp:DetailsView 
        ID="DetailsView1" 
        runat="server"
        AutoGenerateRows="False"
        BackColor="#DEBA84" 
        BorderColor="#DEBA84" 
        BorderStyle="None" 
        BorderWidth="1px" 
        CellPadding="3" 
        CellSpacing="2" 
        DataSourceID="DetailsViewODS" 
        Height="50px" 
        Width="125px">
        <EditRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
        <Fields>
            <asp:BoundField DataField="Cargo_ID" HeaderText="Cargo_ID" SortExpression="Cargo_ID" />
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <asp:BoundField DataField="NameEng" HeaderText="NameEng" SortExpression="NameEng" />
            <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
            <asp:BoundField DataField="DescriptionEng" HeaderText="DescriptionEng" SortExpression="DescriptionEng" />
            <asp:BoundField DataField="ShortCode" HeaderText="ShortCode" SortExpression="ShortCode" />
            <asp:BoundField DataField="Code" HeaderText="Code" SortExpression="Code" />
            <asp:BoundField DataField="CodeGNG" HeaderText="CodeGNG" SortExpression="CodeGNG" />
            <asp:BoundField DataField="Mnemocode" HeaderText="Mnemocode" SortExpression="Mnemocode" />
            <asp:BoundField DataField="MnemocodeEng" HeaderText="MnemocodeEng" SortExpression="MnemocodeEng" />
            <asp:CheckBoxField DataField="IsUsed" HeaderText="IsUsed" SortExpression="IsUsed" />
            <asp:CheckBoxField DataField="IsEmpty" HeaderText="IsEmpty" SortExpression="IsEmpty" />
        </Fields>
        <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
        <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
        <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
        <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
    </asp:DetailsView>
    <br />
    <asp:Button ID="Save" runat="server" OnClick="Save_Click" style="height: 26px" Text="Сохранить" />
    <asp:Button ID="Cancel" runat="server" OnClick="Cancel_Click" Text="Отмена" />
    <br />
    <asp:FileUpload ID="FileUpload1" runat="server" />
    <asp:Button ID="Load_Button" runat="server" OnClick="Load_Button_Click" Text="Загрузить" />
    <asp:FormView runat="server" ID="FormViewForImage" DataSourceID="DetailsViewODS" Visible="false" Width="284px">
                <ItemTemplate>
                    <asp:TextBox Text='<%# Bind("Cargo_ID") %>' runat="server" ID="Cargo_ID" Visible="false" /><br />
                </ItemTemplate>
    </asp:FormView>
</asp:Content>
